home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-05-12 | 40.2 KB | 1,200 lines |
- Newsgroups: comp.sources.misc
- From: Dennis Vadura <dvadura@watdragon.waterloo.edu>
- Subject: v19i045: dmake - dmake version 3.7, Part24/37
- Message-ID: <1991May12.221416.16312@sparky.IMD.Sterling.COM>
- X-Md4-Signature: 6faf1c0510fe9ff177f3ac09d9555458
- Date: Sun, 12 May 1991 22:14:16 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
- Posting-number: Volume 19, Issue 45
- Archive-name: dmake/part24
- Supersedes: dmake-3.6: Volume 15, Issue 52-77
-
- ---- Cut Here and feed the following to sh ----
- #!/bin/sh
- # this is dmake.shar.24 (part 24 of a multipart archive)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file dmake/msdos/mscdos/mk60.bat continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 24; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test -f _shar_wnt_.tmp; then
- sed 's/^X//' << 'SHAR_EOF' >> 'dmake/msdos/mscdos/mk60.bat' &&
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\hash.obj hash.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dag.obj dag.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dmake.obj dmake.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\path.obj path.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\imacs.obj imacs.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\sysintf.obj sysintf.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\parse.obj parse.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\getinp.obj getinp.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\quit.obj quit.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\state.obj state.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\basename.obj basename.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dmdump.obj dmdump.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\macparse.obj macparse.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\rulparse.obj rulparse.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\percent.obj percent.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\function.obj function.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\ruletab.obj msdos\ruletab.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dirbrk.obj msdos\dirbrk.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\runargv.obj msdos\runargv.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\arlib.obj msdos\arlib.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\_chdir.obj msdos\_chdir.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\switchar.obj msdos\switchar.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\rmprq.obj msdos\rmprq.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\tee.obj msdos\tee.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\tempnam.obj msdos\mscdos\tempnam.c
- link @\tmp\mkAAA010699,dmake.exe,NUL.MAP;
- copy msdos\mscdos\startup.mk startup.mk
- SHAR_EOF
- chmod 0640 dmake/msdos/mscdos/mk60.bat ||
- echo 'restore of dmake/msdos/mscdos/mk60.bat failed'
- Wc_c="`wc -c < 'dmake/msdos/mscdos/mk60.bat'`"
- test 2932 -eq "$Wc_c" ||
- echo 'dmake/msdos/mscdos/mk60.bat: original size 2932, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/mscdos/mk60swp.bat ==============
- if test -f 'dmake/msdos/mscdos/mk60swp.bat' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/mscdos/mk60swp.bat (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/mk60swp.bat' &&
- md objects
- masm -t -mx -Dmlarge msdos\exec.asm;
- mv exec.obj objects
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\infer.obj infer.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\make.obj make.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\stat.obj stat.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\expand.obj expand.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dmstring.obj dmstring.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\hash.obj hash.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dag.obj dag.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dmake.obj dmake.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\path.obj path.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\imacs.obj imacs.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\sysintf.obj sysintf.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\parse.obj parse.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\getinp.obj getinp.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\quit.obj quit.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\state.obj state.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\basename.obj basename.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dmdump.obj dmdump.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\macparse.obj macparse.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\rulparse.obj rulparse.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\percent.obj percent.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\function.obj function.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\ruletab.obj msdos\ruletab.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dirbrk.obj msdos\dirbrk.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\runargv.obj msdos\runargv.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\arlib.obj msdos\arlib.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\_chdir.obj msdos\_chdir.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\switchar.obj msdos\switchar.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\rmprq.obj msdos\rmprq.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\find.obj msdos\find.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\spawn.obj msdos\spawn.c
- cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\tempnam.obj msdos\mscdos\tempnam.c
- link @\tmp\mkAAA010738,dmake.exe,NUL.MAP;
- copy msdos\mscdos\startup.mk startup.mk
- SHAR_EOF
- chmod 0640 dmake/msdos/mscdos/mk60swp.bat ||
- echo 'restore of dmake/msdos/mscdos/mk60swp.bat failed'
- Wc_c="`wc -c < 'dmake/msdos/mscdos/mk60swp.bat'`"
- test 3088 -eq "$Wc_c" ||
- echo 'dmake/msdos/mscdos/mk60swp.bat: original size 3088, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/mscdos/obj.rsp ==============
- if test -f 'dmake/msdos/mscdos/obj.rsp' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/mscdos/obj.rsp (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/obj.rsp' &&
- objects\infer.obj+
- objects\make.obj+
- objects\stat.obj+
- objects\expand.obj+
- objects\dmstring.obj+
- objects\hash.obj+
- objects\dag.obj+
- objects\dmake.obj+
- objects\path.obj+
- objects\imacs.obj+
- objects\sysintf.obj+
- objects\parse.obj+
- objects\getinp.obj+
- objects\quit.obj+
- objects\state.obj+
- objects\basename.obj+
- objects\dmdump.obj+
- objects\macparse.obj+
- objects\rulparse.obj+
- objects\percent.obj+
- objects\function.obj+
- objects\ruletab.obj+
- objects\dirbrk.obj+
- objects\runargv.obj+
- objects\arlib.obj+
- objects\_chdir.obj+
- objects\switchar.obj+
- objects\rmprq.obj+
- objects\tee.obj+
- objects\tempnam.obj
- SHAR_EOF
- chmod 0640 dmake/msdos/mscdos/obj.rsp ||
- echo 'restore of dmake/msdos/mscdos/obj.rsp failed'
- Wc_c="`wc -c < 'dmake/msdos/mscdos/obj.rsp'`"
- test 593 -eq "$Wc_c" ||
- echo 'dmake/msdos/mscdos/obj.rsp: original size 593, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/mscdos/objswp.rsp ==============
- if test -f 'dmake/msdos/mscdos/objswp.rsp' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/mscdos/objswp.rsp (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/objswp.rsp' &&
- objects\exec.obj+
- objects\infer.obj+
- objects\make.obj+
- objects\stat.obj+
- objects\expand.obj+
- objects\dmstring.obj+
- objects\hash.obj+
- objects\dag.obj+
- objects\dmake.obj+
- objects\path.obj+
- objects\imacs.obj+
- objects\sysintf.obj+
- objects\parse.obj+
- objects\getinp.obj+
- objects\quit.obj+
- objects\state.obj+
- objects\basename.obj+
- objects\dmdump.obj+
- objects\macparse.obj+
- objects\rulparse.obj+
- objects\percent.obj+
- objects\function.obj+
- objects\ruletab.obj+
- objects\dirbrk.obj+
- objects\runargv.obj+
- objects\arlib.obj+
- objects\_chdir.obj+
- objects\switchar.obj+
- objects\rmprq.obj+
- objects\find.obj+
- objects\spawn.obj+
- objects\tempnam.obj
- SHAR_EOF
- chmod 0640 dmake/msdos/mscdos/objswp.rsp ||
- echo 'restore of dmake/msdos/mscdos/objswp.rsp failed'
- Wc_c="`wc -c < 'dmake/msdos/mscdos/objswp.rsp'`"
- test 631 -eq "$Wc_c" ||
- echo 'dmake/msdos/mscdos/objswp.rsp: original size 631, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/mscdos/optoff.h ==============
- if test -f 'dmake/msdos/mscdos/optoff.h' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/mscdos/optoff.h (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/optoff.h' &&
- #if _MSC_VER < 600
- # pragma loop_opt(off)
- #endif
- SHAR_EOF
- chmod 0640 dmake/msdos/mscdos/optoff.h ||
- echo 'restore of dmake/msdos/mscdos/optoff.h failed'
- Wc_c="`wc -c < 'dmake/msdos/mscdos/optoff.h'`"
- test 49 -eq "$Wc_c" ||
- echo 'dmake/msdos/mscdos/optoff.h: original size 49, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/mscdos/public.h ==============
- if test -f 'dmake/msdos/mscdos/public.h' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/mscdos/public.h (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/public.h' &&
- /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/mscdos/RCS/public.h,v 1.1 91/05/06 15:25:50 dvadura Exp Locker: dvadura $
- -- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT
- --
- -- SYNOPSIS -- Local functions exported to be visible by others.
- --
- -- DESCRIPTION
- -- This file is generated by 'genpub'. Function declarations
- -- that appear in this file are extracted by 'genpub' from
- -- source files. Any function in the source file whose definition
- -- appears like:
- --
- -- PUBLIC return_type
- -- function( arg_list );
- -- type_expr1 arg1;
- -- ...
- --
- -- has its definition extracted and a line of the form:
- --
- -- return_type function ANSI((type_expr1,type_expr2,...));
- --
- -- entered into the output file.
- --
- -- AUTHOR
- -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca
- -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada
- --
- -- COPYRIGHT
- -- Copyright (c) 1990 by Dennis Vadura. All rights reserved.
- --
- -- This program is free software; you can redistribute it and/or
- -- modify it under the terms of the GNU General Public License
- -- (version 1), as published by the Free Software Foundation, and
- -- found in the file 'LICENSE' included with this distribution.
- --
- -- This program is distributed in the hope that it will be useful,
- -- but WITHOUT ANY WARRANTY; without even the implied warrant of
- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- -- GNU General Public License for more details.
- --
- -- You should have received a copy of the GNU General Public License
- -- along with this program; if not, write to the Free Software
- -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- --
- -- LOG
- -- $Log: public.h,v $
- X * Revision 1.1 91/05/06 15:25:50 dvadura
- X * dmake Release Version 3.7
- X *
- */
- X
- #ifndef _DMAKE_PUBLIC_h
- #define _DMAKE_PUBLIC_h
- X
- void Infer_recipe ANSI((CELLPTR, CELLPTR));
- int Make_targets ANSI(());
- int Exec_commands ANSI((CELLPTR));
- void Pop_dir ANSI((int));
- void Append_line ANSI((char *, int, FILE *, char *, int, int));
- void Stat_target ANSI((CELLPTR, int));
- char * Expand ANSI((char *));
- char * Apply_edit ANSI((char *, char *, char *, int, int));
- void Map_esc ANSI((char *));
- char* Apply_modifiers ANSI((int, char *));
- char* Tokenize ANSI((char *, char *));
- char * _strjoin ANSI((char *, char *, int, int));
- char * _stradd ANSI((char *, char *, int));
- char * _strapp ANSI((char *, char *));
- char * _strdup ANSI((char *));
- char * _strpbrk ANSI((char *, char *));
- char * _strspn ANSI((char *, char *));
- char * _strstr ANSI((char *, char *));
- char * _substr ANSI((char *, char *));
- uint16 Hash ANSI((char *, uint32 *));
- HASHPTR Get_name ANSI((char *, HASHPTR *, int));
- HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *));
- HASHPTR Def_macro ANSI((char *, char *, int));
- CELLPTR Def_cell ANSI((char *));
- LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int));
- void Clear_prerequisites ANSI((CELLPTR));
- int Test_circle ANSI((CELLPTR, int));
- STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int));
- t_attr Rcp_attribute ANSI((char *));
- int main ANSI((int, char **));
- FILE * Openfile ANSI((char *, int, int));
- FILE * Closefile ANSI(());
- FILE * Search_file ANSI((char *, char **));
- char * Filename ANSI(());
- void No_ram ANSI(());
- int Usage ANSI((int));
- int Version ANSI(());
- char * Get_suffix ANSI((char *));
- char * Build_path ANSI((char *, char *));
- void Make_rules ANSI(());
- void Create_macro_vars ANSI(());
- time_t Do_stat ANSI((char *, char *, char **));
- int Do_touch ANSI((char *, char *, char **));
- void Void_lib_cache ANSI((char *, char *));
- time_t Do_time ANSI(());
- int Do_cmnd ANSI((char *, int, int, CELLPTR, int, int, int));
- char ** Pack_argv ANSI((int, int, char *));
- char * Read_env_string ANSI((char *));
- int Write_env_string ANSI((char *, char *));
- void ReadEnvironment ANSI(());
- void Catch_signals ANSI((void (*)()));
- void Clear_signals ANSI(());
- void Prolog ANSI((int, char* []));
- void Epilog ANSI((int));
- char * Get_current_dir ANSI(());
- int Set_dir ANSI((char*));
- char Get_switch_char ANSI(());
- FILE* Get_temp ANSI((char **, char *, int));
- FILE * Start_temp ANSI((char *, CELLPTR, char **));
- void Open_temp_error ANSI((char *, char *));
- void Link_temp ANSI((CELLPTR, FILE *, char *));
- void Close_temp ANSI((CELLPTR, FILE *));
- void Unlink_temp_files ANSI((CELLPTR));
- void Handle_result ANSI((int, int, int, CELLPTR));
- void Update_time_stamp ANSI((CELLPTR));
- void Parse ANSI((FILE *));
- int Get_line ANSI((char *, FILE *));
- char * Do_comment ANSI((char *, char **, int));
- char * Get_token ANSI((TKSTRPTR, char *, int));
- void Quit ANSI(());
- void Read_state ANSI(());
- void Write_state ANSI(());
- int Check_state ANSI((CELLPTR, STRINGPTR *, int));
- char* basename ANSI((char *));
- void Dump ANSI(());
- void Dump_recipe ANSI((STRINGPTR));
- int Parse_macro ANSI((char *, int));
- int Macro_op ANSI((char *));
- int Parse_rule_def ANSI((int *));
- int Rule_op ANSI((char *));
- void Add_recipe_to_list ANSI((char *, int, int));
- void Bind_rules_to_targets ANSI((int));
- int Set_group_attributes ANSI((char *));
- DFALINKPTR Match_dfa ANSI((char *));
- void Check_circle_dfa ANSI(());
- void Add_nfa ANSI((char *));
- char * Exec_function ANSI((char *));
- int If_root_path ANSI((char *));
- int runargv ANSI((CELLPTR, int, int, int, int, char *));
- void Clean_up_processes ANSI(());
- int Wait_for_child ANSI((int, int));
- time_t seek_arch ANSI((char*, char*));
- int touch_arch ANSI((char*, char*));
- int _chdir ANSI((char *));
- void Remove_prq ANSI((CELLPTR));
- void Hook_std_writes ANSI((char *));
- X
- #endif
- SHAR_EOF
- chmod 0640 dmake/msdos/mscdos/public.h ||
- echo 'restore of dmake/msdos/mscdos/public.h failed'
- Wc_c="`wc -c < 'dmake/msdos/mscdos/public.h'`"
- test 5622 -eq "$Wc_c" ||
- echo 'dmake/msdos/mscdos/public.h: original size 5622, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/mscdos/startup.mk ==============
- if test -f 'dmake/msdos/mscdos/startup.mk' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/mscdos/startup.mk (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/startup.mk' &&
- # MSDOS DMAKE startup file. Customize to suit your needs.
- # Assumes MKS toolkit for the tool commands, and Microsoft C. Change as req'd.
- # See the documentation for a description of internally defined macros.
- #
- # Disable warnings for macros redefined here that were given
- # on the command line.
- __.SILENT := $(.SILENT)
- .SILENT := yes
- X
- # Configuration parameters for DMAKE startup.mk file
- # Set these to NON-NULL if you wish to turn the parameter on.
- _HAVE_RCS := yes # yes => RCS is installed.
- _HAVE_SCCS := # yes => SCCS is installed.
- X
- # Applicable suffix definitions
- A := .lib # Libraries
- E := .exe # Executables
- F := .for # Fortran
- O := .obj # Objects
- P := .pas # Pascal
- S := .asm # Assembler sources
- V := # RCS suffix
- X
- # See if these are defined
- TMPDIR := $(ROOTDIR)/tmp
- .IMPORT .IGNORE : TMPDIR SHELL COMSPEC
- X
- # Recipe execution configurations
- # First set SHELL, If it is not defined, use COMSPEC, otherwise
- # it is assumed to be MKS Korn SHELL.
- .IF $(SHELL) == $(NULL)
- .IF $(COMSPEC) == $(NULL)
- X SHELL := $(ROOTDIR)/bin/sh$E
- .ELSE
- X SHELL := $(COMSPEC)
- .END
- .END
- GROUPSHELL := $(SHELL)
- X
- # Now set remaining arguments depending on which SHELL we
- # are going to use. COMSPEC (assumed to be command.com) or
- # MKS Korn Shell.
- .IF $(SHELL)==$(COMSPEC)
- X SHELLFLAGS := $(SWITCHAR)c
- X GROUPFLAGS := $(SHELLFLAGS)
- X SHELLMETAS := *"?<>
- X GROUPSUFFIX := .bat
- X DIRSEPSTR := \\
- X DIVFILE = $(TMPFILE:s,/,\)
- .ELSE
- X SHELLFLAGS := -c
- X GROUPFLAGS :=
- X SHELLMETAS := *"?<>|()&][$$\#`'
- X GROUPSUFFIX := .ksh
- X .MKSARGS := yes
- X DIVFILE = $(TMPFILE:s,/,${DIVSEP_shell_${USESHELL}})
- X DIVSEP_shell_yes := \\\
- X DIVSEP_shell_no := \\
- .END
- X
- # Standard C-language command names and flags
- X CC := cl # C-compiler and flags
- X CFLAGS +=
- X
- X AS := masm # Assembler and flags
- X ASFLAGS +=
- X
- X LD = link # Loader and flags
- X LDFLAGS +=
- X LDLIBS =
- X
- # Definition of $(MAKE) macro for recursive makes.
- X MAKE = $(MAKECMD) $(MFLAGS)
- X
- # Language and Parser generation Tools and their flags
- X YACC := yacc # standard yacc
- X YFLAGS +=
- X YTAB := ytab # yacc output files name stem.
- X
- X LEX := lex # standard lex
- X LFLAGS +=
- X LEXYY := lex_yy # lex output file
- X
- # Other Compilers, Tools and their flags
- X PC := any_pc # pascal compiler
- X RC := anyf77 # ratfor compiler
- X FC := anyf77 # fortran compiler
- X
- X CO := co # check out for RCS
- X COFLAGS += -q
- X
- X AR := ar # archiver
- X ARFLAGS+= ruv
- X
- X RM := rm # remove a file command
- X RMFLAGS +=
- X
- # Implicit generation rules for making inferences.
- # We don't provide .yr or .ye rules here. They're obsolete.
- # Rules for making *$O
- X %$O : %.c ; $(CC) $(CFLAGS) -c $<
- X %$O : %$P ; $(PC) $(PFLAGS) -c $<
- X %$O : %$S ; $(AS) $(ASFLAGS) $(<:s,/,\);
- X %$O : %.cl ; class -c $<
- X %$O : %.e %.r %.F %$F ; $(FC) $(RFLAGS) $(EFLAGS) $(FFLAGS) -c $<
- X
- # Executables
- X %$E : %$O ; $(CC) $(LDFLAGS) -o$@ $< $(LDLIBS)
- X
- # lex and yacc rules
- X %.c : %.y ; $(YACC) $(YFLAGS) $<; mv $(YTAB).c $@
- X %.c : %.l ; $(LEX) $(LFLAGS) $<; mv $(LEXYY).c $@
- X
- # RCS support
- .IF $(_HAVE_RCS)
- X % : $$(@:d)RCS$$(DIRSEPSTR)$$(@:f)$V;- $(CO) $(COFLAGS) $@
- X .NOINFER : $$(@:d)RCS$$(DIRSEPSTR)$$(@:f)$V
- .END
- X
- # SCCS support
- .IF $(_HAVE_SCCS)
- X % : s.% ; get $@
- X .NOINFER : s.%
- .END
- X
- # Recipe to make archive files.
- %$A :
- [
- X $(AR) $(ARFLAGS) $@ $?
- X $(RM) $(RMFLAGS) $?
- ]
- X
- # DMAKE uses this recipe to remove intermediate targets
- .REMOVE :; $(RM) -f $<
- X
- # AUGMAKE extensions for SYSV compatibility
- @B = $(@:b)
- @D = $(@:d)
- @F = $(@:f)
- *B = $(*:b)
- *D = $(*:d)
- *F = $(*:f)
- <B = $(<:b)
- <D = $(<:d)
- <F = $(<:f)
- ?B = $(?:b)
- ?F = $(?:f)
- ?D = $(?:d)
- X
- # Turn warnings back to previous setting.
- .SILENT := $(__.SILENT)
- X
- # Local init file if any, gets parsed before user makefile
- .INCLUDE .IGNORE: "_startup.mk"
- SHAR_EOF
- chmod 0640 dmake/msdos/mscdos/startup.mk ||
- echo 'restore of dmake/msdos/mscdos/startup.mk failed'
- Wc_c="`wc -c < 'dmake/msdos/mscdos/startup.mk'`"
- test 3822 -eq "$Wc_c" ||
- echo 'dmake/msdos/mscdos/startup.mk: original size 3822, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/mscdos/tempnam.c ==============
- if test -f 'dmake/msdos/mscdos/tempnam.c' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/mscdos/tempnam.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/tempnam.c' &&
- /*LINTLIBRARY*/
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <dos.h>
- X
- #if defined(max)
- # undef max
- #endif
- #define max(A,B) (((A)<(B))?(B):(A))
- X
- extern char *mktemp();
- extern int access();
- int _access();
- X
- /* MSC stdio.h defines P_tmpdir, so let's undo it here */
- /* Under DOS leave the default tmpdir pointing here! */
- #ifdef P_tmpdir
- #undef P_tmpdir
- #endif
- static char *P_tmpdir = "";
- X
- char *
- tempnam(dir, prefix)
- char *dir; /* use this directory please (if non-NULL) */
- char *prefix; /* use this (if non-NULL) as filename prefix */
- {
- X static int count = 0;
- X register char *p, *q, *tmpdir;
- X int tl=0, dl=0, pl;
- X char buf[30];
- X
- X pl = strlen(P_tmpdir);
- X
- X if( (tmpdir = getenv("TMPDIR")) != NULL ) tl = strlen(tmpdir);
- X if( dir != NULL ) dl = strlen(dir);
- X
- X if( (p = malloc((unsigned)(max(max(dl,tl),pl)+13))) == NULL )
- X return(NULL);
- X
- X *p = '\0';
- X
- X if( (tl == 0) || (_access( strcpy(p, tmpdir), 0) != 0) )
- X if( (dl == 0) || (_access( strcpy(p, dir), 0) != 0) )
- X if( _access( strcpy(p, P_tmpdir), 0) != 0 )
- X if( !prefix )
- X prefix = "tp";
- X
- X if(prefix)
- X {
- X *(p+strlen(p)+2) = '\0';
- X (void)strncat(p, prefix, 2);
- X }
- X
- X sprintf( buf, "%08x", _psp );
- X buf[6]='\0';
- X (void)strcat(p, buf );
- X sprintf( buf, "%04d", count++ );
- X q=p+strlen(p)-6;
- X *q++ = buf[0]; *q++ = buf[1];
- X *q++ = buf[2]; *q++ = buf[3];
- X
- X if( (q = strrchr(p,'.')) != NULL ) *q = '\0';
- X
- X return(p);
- }
- X
- X
- X
- _access( name, flag )
- char *name;
- int flag;
- {
- X char *p;
- X int r;
- X
- X if( name == NULL || !*name ) return(1); /* NULL dir means current dir */
- X r = access( name, flag );
- X p = name+strlen(name)-1;
- X if(*p != '/' && *p != '\\') strcat( p, "/" );
- X
- X return( r );
- }
- SHAR_EOF
- chmod 0640 dmake/msdos/mscdos/tempnam.c ||
- echo 'restore of dmake/msdos/mscdos/tempnam.c failed'
- Wc_c="`wc -c < 'dmake/msdos/mscdos/tempnam.c'`"
- test 1754 -eq "$Wc_c" ||
- echo 'dmake/msdos/mscdos/tempnam.c: original size 1754, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/rmprq.c ==============
- if test -f 'dmake/msdos/rmprq.c' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/rmprq.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/rmprq.c' &&
- /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/rmprq.c,v 1.1 91/05/06 15:25:31 dvadura Exp $
- -- SYNOPSIS -- remove prerequisites code.
- --
- -- DESCRIPTION
- -- This code is different for DOS and for UNIX and parallel make
- -- architectures since the parallel case requires the rm's to be
- -- run in parallel, whereas DOS guarantees to run them sequentially.
- --
- -- AUTHOR
- -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca
- -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada
- --
- -- COPYRIGHT
- -- Copyright (c) 1990 by Dennis Vadura. All rights reserved.
- --
- -- This program is free software; you can redistribute it and/or
- -- modify it under the terms of the GNU General Public License
- -- (version 1), as published by the Free Software Foundation, and
- -- found in the file 'LICENSE' included with this distribution.
- --
- -- This program is distributed in the hope that it will be useful,
- -- but WITHOUT ANY WARRANTY; without even the implied warrant of
- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- -- GNU General Public License for more details.
- --
- -- You should have received a copy of the GNU General Public License
- -- along with this program; if not, write to the Free Software
- -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- --
- -- LOG
- -- $Log: rmprq.c,v $
- X * Revision 1.1 91/05/06 15:25:31 dvadura
- X * dmake Release Version 3.7
- X *
- */
- X
- #include "extern.h"
- X
- PUBLIC void
- Remove_prq( tcp )
- CELLPTR tcp;
- {
- X tcp->ce_flag &= ~(F_MADE|F_VISITED);
- X tcp->ce_time = 0L;
- X
- X Make( tcp, NIL(LINK), NIL(CELL) );
- }
- SHAR_EOF
- chmod 0640 dmake/msdos/rmprq.c ||
- echo 'restore of dmake/msdos/rmprq.c failed'
- Wc_c="`wc -c < 'dmake/msdos/rmprq.c'`"
- test 1640 -eq "$Wc_c" ||
- echo 'dmake/msdos/rmprq.c: original size 1640, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/ruletab.c ==============
- if test -f 'dmake/msdos/ruletab.c' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/ruletab.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/ruletab.c' &&
- /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/ruletab.c,v 1.1 91/05/06 15:25:32 dvadura Exp $
- -- SYNOPSIS -- Default initial configuration of dmake.
- --
- -- DESCRIPTION
- -- Define here the initial set of rules that are defined before
- -- dmake performs any processing.
- --
- -- AUTHOR
- -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca
- -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada
- --
- -- COPYRIGHT
- -- Copyright (c) 1990 by Dennis Vadura. All rights reserved.
- --
- -- This program is free software; you can redistribute it and/or
- -- modify it under the terms of the GNU General Public License
- -- (version 1), as published by the Free Software Foundation, and
- -- found in the file 'LICENSE' included with this distribution.
- --
- -- This program is distributed in the hope that it will be useful,
- -- but WITHOUT ANY WARRANTY; without even the implied warrant of
- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- -- GNU General Public License for more details.
- --
- -- You should have received a copy of the GNU General Public License
- -- along with this program; if not, write to the Free Software
- -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- --
- -- LOG
- -- $Log: ruletab.c,v $
- X * Revision 1.1 91/05/06 15:25:32 dvadura
- X * dmake Release Version 3.7
- X *
- */
- X
- /* These are control macros for dmake that MUST be defined at some point
- X * if they are NOT dmake will not work! These are default definitions. They
- X * may be overridden inside the .STARTUP makefile, they are here
- X * strictly so that dmake can parse the STARTUP makefile */
- X
- static char *_rules[] = {
- X "MAXLINELENGTH := 2046",
- X "MAXPROCESSLIMIT := 1",
- X "MAXPROCESS := 1",
- X ".IMPORT .IGNORE: ROOTDIR",
- X ".MAKEFILES : makefile.mk makefile",
- X ".SOURCE : .NULL",
- #include "startup.h"
- X 0 };
- X
- char **Rule_tab = _rules; /* for sundry reasons in Get_environment() */
- X
- SHAR_EOF
- chmod 0640 dmake/msdos/ruletab.c ||
- echo 'restore of dmake/msdos/ruletab.c failed'
- Wc_c="`wc -c < 'dmake/msdos/ruletab.c'`"
- test 1951 -eq "$Wc_c" ||
- echo 'dmake/msdos/ruletab.c: original size 1951, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/runargv.c ==============
- if test -f 'dmake/msdos/runargv.c' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/runargv.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/runargv.c' &&
- /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/runargv.c,v 1.1 91/05/06 15:25:32 dvadura Exp $
- -- SYNOPSIS -- run a sub process.
- --
- -- DESCRIPTION
- -- Use spawn to run a subprocess.
- --
- -- AUTHOR
- -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca
- -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada
- --
- -- COPYRIGHT
- -- Copyright (c) 1990 by Dennis Vadura. All rights reserved.
- --
- -- This program is free software; you can redistribute it and/or
- -- modify it under the terms of the GNU General Public License
- -- (version 1), as published by the Free Software Foundation, and
- -- found in the file 'LICENSE' included with this distribution.
- --
- -- This program is distributed in the hope that it will be useful,
- -- but WITHOUT ANY WARRANTY; without even the implied warrant of
- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- -- GNU General Public License for more details.
- --
- -- You should have received a copy of the GNU General Public License
- -- along with this program; if not, write to the Free Software
- -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- --
- -- LOG
- -- $Log: runargv.c,v $
- X * Revision 1.1 91/05/06 15:25:32 dvadura
- X * dmake Release Version 3.7
- X *
- */
- X
- #include <process.h>
- #include <errno.h>
- #include "extern.h"
- #include "sysintf.h"
- X
- static int _abort_flg = FALSE;
- static void _add_child ANSI((CELLPTR, int));
- static void _finished_child ANSI((int));
- X
- PUBLIC int
- runargv(target, ignore, group, last, shell, cmd)
- CELLPTR target;
- int ignore;
- int group;
- int last;
- int shell;
- char *cmd;
- {
- #if ! defined(_MSC_VER)
- X extern char **environ;
- #endif
- X int status;
- X char **argv;
- X
- X argv = Pack_argv( group, shell, cmd );
- X _add_child(target, ignore);
- X status = spawnvpe(P_WAIT, *argv, argv, environ);
- X if( status == -1 ) Error("%s: %s", argv[0], strerror(errno));
- X _finished_child(status);
- X if( last && !Doing_bang ) Update_time_stamp( target );
- X
- X return( 0 );
- }
- X
- X
- PUBLIC void
- Clean_up_processes()
- {
- X _abort_flg = TRUE;
- X _finished_child(-1);
- }
- X
- X
- PUBLIC int
- Wait_for_child( abort_flg, pid )
- int abort_flg;
- int pid;
- {
- X return(1);
- }
- X
- X
- static int _valid = -1;
- static CELLPTR _tg;
- static int _ignore;
- X
- static void
- _add_child( target, ignore )
- CELLPTR target;
- int ignore;
- {
- X _tg = target;
- X _ignore = ignore;
- X _valid = 0;
- X
- X Current_target = NIL(CELL);
- }
- X
- X
- static void
- _finished_child(status)
- int status;
- {
- X if( _valid == -1 ) return;
- X Unlink_temp_files( _tg );
- X _valid = -1;
- X Handle_result( status, _ignore, _abort_flg, _tg );
- }
- SHAR_EOF
- chmod 0640 dmake/msdos/runargv.c ||
- echo 'restore of dmake/msdos/runargv.c failed'
- Wc_c="`wc -c < 'dmake/msdos/runargv.c'`"
- test 2611 -eq "$Wc_c" ||
- echo 'dmake/msdos/runargv.c: original size 2611, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/msdos/spawn.c ==============
- if test -f 'dmake/msdos/spawn.c' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/msdos/spawn.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/spawn.c' &&
- /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/spawn.c,v 1.1 91/05/06 15:25:33 dvadura Exp $
- -- SYNOPSIS -- spawnvpe code to emulate spawnvpe call common to DOS compilers.
- --
- -- DESCRIPTION
- -- This implementation is further integrated into dmake in that it
- -- determines the program to execute and if it's extension is either
- -- .bat or .ksh it executes it using the appropriate shell based on the
- -- setting of .MKSARGS. If .MKSARGS is set then in addition
- -- to the command tail getting built the arguments are also passed in the
- -- environment pursuant to the published MKS argument passing conventions.
- -- If the variable Swap_on_exec is set and the DOS OS supports it
- -- then the dmake executable image is swapped to secondary storage prior
- -- to running the child process. This is requested by setting the
- -- appropriate flag in the call to exec.
- --
- -- This and the exec.asm routine are derived from work that was supplied
- -- to me by Kent Williams (williams@umaxc.weeg.uiowa.edu) and by
- -- Len Reed, (..!gatech!holos0!lbr or holos0!lbr@gatech.edu., Holos
- -- Software, Inc., Tucker, Ga.). I sincerely acknowledge their help since
- -- their Turbo C, and MSC 6.0 code lead directly to this combined
- -- swapping exec that hopefully works with either compiler in all memory
- -- models.
- --
- -- AUTHOR
- -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca
- -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada
- --
- -- COPYRIGHT
- -- Copyright (c) 1990 by Dennis Vadura. All rights reserved.
- --
- -- This program is free software; you can redistribute it and/or
- -- modify it under the terms of the GNU General Public License
- -- (version 1), as published by the Free Software Foundation, and
- -- found in the file 'LICENSE' included with this distribution.
- --
- -- This program is distributed in the hope that it will be useful,
- -- but WITHOUT ANY WARRANTY; without even the implied warrant of
- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- -- GNU General Public License for more details.
- --
- -- You should have received a copy of the GNU General Public License
- -- along with this program; if not, write to the Free Software
- -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- --
- -- LOG
- -- $Log: spawn.c,v $
- X * Revision 1.1 91/05/06 15:25:33 dvadura
- X * dmake Release Version 3.7
- X *
- */
- X
- #include <stdio.h>
- #include <stdlib.h>
- X
- #if defined(_MSC_VER) && _MSC_VER >= 600
- X /* Ignore the MSC 6.0 library's "const"-riddled prototype
- X for spawnvpe.
- X */
- # define spawnvpe _ignore_msc_spawnvpe
- # include <process.h>
- # undef spawnvpe
- X int spawnvpe(int, char *, char **, char **);
- #else
- # include <process.h>
- #endif
- X
- #include <dos.h>
- #include <errno.h>
- #include <string.h>
- #include <alloc.h>
- #include <fcntl.h>
- #include "extern.h"
- #include "dirlib.h"
- #include "exec.h"
- #include "sysintf.h"
- X
- extern int Interrupted;
- X
- /* variables and functions local to this file */
- static char *_findexec ANSI((char *, int *));
- static char **_getpath ANSI(());
- static char far *_dos_alloc ANSI((uint16));
- X
- static uint16 _swap_mask;
- static int _mks_args;
- static char dot_com[] = ".COM",
- X dot_exe[] = ".EXE",
- X dot_bat[] = ".BAT",
- X dot_ksh[] = ".KSH";
- X
- /* Kinds of executables */
- #define SCR 1
- #define COM 2
- #define EXE 4
- #define ALL (SCR|COM|EXE)
- X
- /* How to make a long pointer */
- #define CF(x) (char far *)x
- X
- /* Make sure we know how to get a segment out of a long pointer */
- #ifndef FP_SEG
- #define FP_SEG(fp) ((unsigned)((unsigned long)(fp) >> 16))
- #endif
- X
- X
- PUBLIC int
- spawnvpe(mode, program, av, ep)/*
- =================================
- X Spawn a process using an environment and a vector of arguments.
- X The code computes a new environment, puts the MKS arguments into
- X it if need be, and calls the appropriate routines to search the
- X path and to invoke the process. */
- int mode;
- char *program;
- char **av;
- char **ep;
- {
- X char **envp = ep; /* Cause we are going to mess with it. */
- X char **argv = av; /* Same with this one. */
- X char cmdtail[129];
- X char far *environment;
- X char *tail;
- X char *swptmp;
- X unsigned int envsize;
- X unsigned int cmdsize;
- X int cmdtailen;
- X int i;
- X int doswap;
- X
- X /* First check to see if we can find the program to execute this way we
- X * don't alloc the environment and other such stuff prior to figuring out
- X * we don't know how to run the program. */
- find_program:
- X if((program = _findexec(program, &i)) == NIL(char)) {
- X errno = ENOENT;
- X return( -1 );
- X }
- X
- X /* i is set to TRUE in _findexec if the exec is a shell
- X * script (either .BAT or .KSH file), returns FALSE for all others. */
- X if( i && !Packed_shell ) {
- X /* Restore the spaces into the command line that were erased by
- X * the previous call to Pack_argv. This enables us to repack the
- X * command as a shell command using Pack_argv again. */
- X for( i=0; argv[i] != NIL(char); i++ ) {
- X int x = strlen(argv[i]);
- X if( argv[i+1] != NIL(char) ) argv[i][x] = ' ';
- X }
- X
- X argv = Pack_argv( FALSE, TRUE, *argv );
- X
- X /* Go and find the program again, I hate goto's but it seems silly to
- X * use tail recursion here just for aesthetic purity. */
- X program = *argv;
- X goto find_program;
- X }
- X
- X /* Compute size of *argv vector for passing as MKS style arguments */
- X cmdsize = strlen(*argv)+2;
- X
- X /* So we have decided on a program to run, therefore pack the command tail
- X * and build the environment to pass to the exec code. This loop packs the
- X * DOS command tail, and computes the size of all arguments for the MKS
- X * argument passing convention. Note that we reserve one less byte in the
- X * command tail if we are not using MKS style argument passing.
- X *
- X * Make sure the command tail contains at leat a space. Some commands fail
- X * to work if the command tail is only a \r, STUPID DOS! */
- X cmdtailen = (_mks_args = ((Glob_attr & A_MKSARGS) != 0))?3:2;
- X tail = cmdtail+1;
- X
- X if( argv[1] != NIL(char) )
- X for( i=1; argv[i] != NIL(char); i++ ) {
- X int arglen = strlen(argv[i]);
- X
- X cmdsize += arglen+2; /* Compute all args size for MKS */
- X
- X if( (cmdtailen += arglen+1) <= 128 ) {
- X register char *p = argv[i];
- X tail[-1] = ' '; /* put in the space */
- X while( *tail++ = *p++ ); /* put in the arg */
- X }
- X else if( !_mks_args ) {
- X errno = E2BIG; /* unless its MKS exit if arglist */
- X return(-1); /* is too long. */
- X }
- X }
- X else
- X *tail++ = ' ';
- X
- X /* Finish the command tail set up, placing the length in the first byte,
- X * and the \r \n \0 at the end for DOS, MKS and us respectively. */
- X *cmdtail = tail-cmdtail-2;
- X tail[-1] = '\r';
- X if( _mks_args ) *tail++ = '\n';
- X *tail = '\0';
- X
- X /* Compute size of environment, skipping any MKS arguments passed in our
- X * environment */
- X for(; *envp && **envp == '~'; envp++ );
- X for(i=0, envsize=_mks_args?cmdsize:1; envp[i] != NIL(char); i++ )
- X envsize += strlen(envp[i]) + 1;
- X
- X /* Check the DOS version number here. If it is < 3.0 then we don't
- X * even want to think about executing the swapping code. Permanently
- X * set swap to 0. */
- X doswap = (_osmajor < 3) ? 0 : Swap_on_exec;
- X
- X /* Set up temporary file for swapping */
- X swptmp = doswap?tempnam(NIL(char),"mk"):"";
- X
- X /* Allocate an appropriate sized environment block and align it on a
- X * paragraph boundary. It will later get copied to an appropriately low
- X * place in the executable image so that when we swap out the environment
- X * is still present. Use
- X * _dos_alloc
- X * to allocate the environment segment. The segment is freed by the call
- X * to exec. */
- X environment = _dos_alloc( envsize = ((envsize+16)>>4) );
- X
- X /* First copy the arguments preceeded by ~ character if we are using
- X * MKS style argument passing */
- X if( _mks_args )
- X for(; *argv; argv++) {
- X register char *p = *argv;
- X
- X *environment++ = '~';
- X while( *environment++ = *p++ ); /* Far dest, poss near ptr */
- X }
- X
- X /* Now stick in the current evironment vectors. */
- X for(; *envp; envp++) {
- X register char *p = *envp;
- X while( *environment++ = *p++ ); /* Far dest, poss near ptr */
- X }
- X *environment = '\0';
- X
- X /* Clear the interrupted flag, and exec */
- X Interrupted = 0;
- X i = exec(doswap,CF(program),CF(cmdtail),FP_SEG(environment),CF(swptmp));
- X
- X /* Now free the temporary file name */
- X if( doswap ) FREE(swptmp);
- X
- X /* If swap was interrupted then quit properly from dmake. */
- X if( Interrupted ) Quit();
- X
- X return(i);
- }
- X
- X
- PUBLIC void
- Hook_std_writes( file )
- char *file;
- {
- X if( file!= NIL(char) ) {
- X int mode = O_BINARY | O_WRONLY | O_CREAT | O_TRUNC;
- X int handle;
- X
- X if (*file == '+') {
- X ++file; /* -F +file means append to file */
- SHAR_EOF
- true || echo 'restore of dmake/msdos/spawn.c failed'
- fi
- echo 'End of part 24, continue with part 25'
- echo 25 > _shar_seq_.tmp
- exit 0
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-